articles

Home / DeveloperSection / Articles / JQuery vs JavaScript

JQuery vs JavaScript

JQuery vs JavaScript

Anonymous User 1236 07-Sep-2019

JQuery vs JavaScript

JavaScript:-

JQuery vs JavaScript

While we JS (JavaScript) is known as a scripting language, but we can also say that it is also a dynamic programming language. This is an interpreted language. Discontiguous from the unfortunate similarity in name, it has nothing to do with the Java programming language. Like as the name suggests, JavaScript is a scripting language. This is most commonly used for appealing UI (like moving objects, flashy elements in the screen), user interactions (client-side validation, showing a pop-up, etc.) and for controlling the document content displayed to the user. There is nothing you need to include in the browser to support JavaScript. This is because it was considered as the language of the web since its birth. It runs in all modern browsers without any additional plugins.

What you mean by JavaScript is dynamic

Most programming languages have dynamic behaviors. However in the case of JavaScript, pretty much everything is dynamic. All variables are dynamic in type and existence. You declare a variable as,

var msg = "Hello World!"; 
1.

The code written in JavaScript is dynamic, you can create a variable at runtime, and the type is determined at runtime. You can create new functions or replace existing functions at runtime. New codes are added to the browser when more script files are loaded and you can add any number of files at any time.

JQuery

JQuery vs JavaScript

Often any website created through the JQuery language always defines jQuery (jQ). Because "jQuery is a fast and concise JavaScript library that simplifies HTML document traversing, event handling, animating, and Ajax interactions for faster web development." That's jQuery is not a programming language instead it is a cross-platform JavaScript library. Those are many other JavaScript libraries available like MooTools, Knockout or even Angular (Though Angular uses TypeScript, it compiles to JavaScript at the end) and jQuery is one of the most popular among them. JQuery may be a quick feature-rich JavaScript library. it's created to assist programmers with making common UI and watch out of the browser compatibility problems additional simply. JQuery, in fact, is nothing however JavaScript. All the code you write in jQuery is born-again to JavaScript internally. One line of code written mistreatment jQuery is also adequate several lines of code written mistreatment JavaScript which implies programmers can write solely lesser lines of code.

To start mistreatment jQuery on your page, you would like to incorporate one line of code within the header of your page like,

<script src="https://ajax.aspnetcdn.com/ajax/jQuery/jquery-3.2.1.min.js"> </script >  
1.

The above line includes a jQuery library to your page using the Microsoft CDN (Content Delivery Network). The jQuery library is a single JavaScript file. We can also include the jQuery library as a local resource from your project folder. But there are benefits using the CDN. If you use the minified version of the library, you will get the advantage of concurrent connections and multiple servers.

JavaScript Vs jQuery

JQuery vs JavaScript

Possibly now, we can discuss the questions mentioned at the beginning of this article. Most of those queries can arise due to a lack of clear understanding of JavaScript and jQuery. So far we have understood that jQuery is nothing but a library of JavaScript, it cannot replace JavaScript. Each jQuery code is JavaScript, but not all jQuery code is included in JavaScript code. Finally, we must understand that they are not two programming languages; instead, they are both JavaScript. JQuery is simply optimized to perform common scripting functions with fewer lines of code.

Lines of code

Mostly actions like Animate, Delay, and Fade-In can be done using jQuery with very few lines of code. On the other hand, JavaScript will take lots of lines of code for the same.

We can consider a simpler example, suppose we want to select all elements having class- simple-li,

If I use JavaScript,

1.    document.getElementsByClassName("welcome");  
1.

On the other hand, if I use jQuery,

2.    $('welcome')
1.
2.

Performance

If you check the performance of the two, you’ll be able to realize that plain JavaScript is quicker than jQuery for accessing DOM. however JavaScript will be slower after you write some advanced logic given the very fact that we tend to might create major mistakes or use poor code which can cause a performance hit. On the opposite hand, jQuery has been tested for years to use best and quick JavaScript codes. In my view, it's not right to match the two otherwise you cannot say one is better than the other. We want to use whichever is better suited to our demand.


I am a content writter !

Leave Comment

Comments

Liked By